<?php 
/**
 * Content - SimpleProductSnapshot
 *
 * @version 1.4.9
 * @package Joomla
 * @subpackage plugins
 * 
 * @author Bruno Pourtier
 * @website http://forge.joomla.org/gf/project/simplesnapshot/
 * @email bruno.pourtier@gmail.com
 * @copyright (C) 2008-2010 Bruno Pourtier
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 *
 * http://www.joomla.org
 *
 * VirtueMart is Free Software.
 * VirtueMart comes with absolute no warranty.
 * http://virtuemart.net
 */
if( !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

/**
 * Customize the price if you want to display a special price
 */
//$product_price = "$".number_format($base_price/12, 2); // Uncomment this line to use custom price instead of the formatted one
?>
<div class="sps_product">
	<?php if(!empty($show_product_name)): ?>
  <span class="product_name"><?php echo $product_name; ?></span>
	<?php endif; ?>
	<?php if(!empty($show_product_image)): ?>
  <span class="product_image">
    <a title="<?php echo $product_name; ?>" href="<?php echo $product_link; ?>">
      <?php echo ps_product::image_tag( $product_thumb_image, "alt=\"{$product_name}\""); ?>
    </a>
  </span>
	<?php endif; ?>
	<?php if(!empty($show_product_desc)): ?>
  <span class="product_s_desc">
    <?php echo $product_s_desc; ?>
  </span>
	<?php endif; ?>
	<?php if(!empty($show_product_description)): ?>
  <span class="product_description">
    <?php echo $product_description; ?>
  </span>
	<?php endif; ?>
	<?php if(!empty($show_product_price)): ?>
  <span class="product_price">
    <?php echo $product_price; ?>
  </span>
	<?php endif; ?>
	<?php if(!empty($show_product_unit) && $product_unit): ?>
	<span class="product_unit">
    <?php echo JText::_('SPS_PRODUCTUNIT') . $product_unit; ?>
  </span>
	<?php endif; ?>
	<?php if(!empty($show_link_addtocart)): ?>
  <form action="<?php echo $mm_action_url; ?>index.php" method="post" name="addtocart" id="<?php echo $cartId = uniqid('addtocart_'); ?>" class="product_link_addtocart" <?php if( $this->get_cfg( 'useAjaxCartActions', 1 ) && $ajax) { echo 'onsubmit="handleAddToCart( this.id ); return false;"'; } ?>>
    <?php if ($show_product_attribute): ?>		
    <div class="product_attribute">
      <?php echo ps_product_attribute::list_advanced_attribute($product_id); ?><br />
    </div>
    <div class="product_attribute_custom">
      <?php echo ps_product_attribute::list_custom_attribute($product_id); ?>
    </div>
    <div class="product_child">
      <?php echo VirtueMartProductSnapshot::displayAttributes($product_id); ?>
    </div>
    <?php endif; ?>
    <?php if(!empty($show_product_quantity)): ?>
    <div class="product_quantity">
      <label for="<?php echo $cartId; ?>_quantity" class="quantity_box"><?php echo JText::_('SPS_QUANTITY'); ?>&nbsp;</label>
      <input class="inputboxquantity" size="4" id="<?php echo $cartId; ?>_quantity" name="quantity[]" value="1" type="text">
      <input class="quantity_box_button quantity_box_button_up" onclick="var qty_el = document.getElementById('<?php echo $cartId; ?>_quantity'); var qty = qty_el.value; if( !isNaN( qty )) qty_el.value++;return false;" type="button" />
      <input class="quantity_box_button quantity_box_button_down" onclick="var qty_el = document.getElementById('<?php echo $cartId; ?>_quantity'); var qty = qty_el.value; if( !isNaN( qty ) &amp;&amp; qty > 0 ) qty_el.value--;return false;" type="button" />
    </div>
    <?php else: ?>
    <input type="hidden" name="quantity[]" value="1" />
    <?php endif; ?>
    <input type="hidden" name="option" value="com_virtuemart" />
    <input type="hidden" name="page" value="shop.cart" />
    <input type="hidden" name="Itemid" value="<?php echo $itemid; ?>" />
    <input type="hidden" name="func" value="cartAdd" />
    <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
    <input type="hidden" name="set_price[]" value="" />
    <input type="hidden" name="adjust_price[]" value="" />
    <input type="hidden" name="master_product[]" value="" />
    <input type="submit" class="addtocart_button_module" value="<?php echo JText::_('SPS_ADDTOCART'); ?>" title="<?php echo JText::_('SPS_ADDTOCART'); ?>" />
  </form>
	<?php endif; ?>
	<?php if(!empty($show_product_reviews)): ?>
		<div class="product_reviews">
			<?php echo ps_reviews::show_reviews($product_id); ?>
		</div>
	<?php endif; ?>
	<?php if(!empty($show_product_rating)): ?>
		<div class="product_rating">
			<?php echo ps_reviews::allvotes($product_id); ?>
		</div>
	<?php endif; ?>
	<?php if(!empty($show_link_mycart)): ?>
		<span class="product_link_mycart">
			<a href="<?php echo $mycart_link; ?>" title="<?php echo JText::_('SPS_MYCART'); ?>">
				<?php echo JText::_('SPS_MYCART'); ?>
			</a>
		</span>
	<?php endif; ?>
	<?php if(!empty($show_link_readmore)): ?>
		<span class="product_link_readmore">
			<a href="<?php echo $product_link; ?>" title="<?php echo JText::_('SPS_READMORE'); ?>">
				<?php echo JText::_('SPS_READMORE'); ?>
			</a>
		</span>
	<?php endif; ?>
</div>